package com.google.code.wicket.auth.component.value.resolver;

import java.util.Collection;

/**
 * An adapter for {@link ValueResolver} that lets you implement only
 * {@link #getValues(Class)} and throws an {@link UnsupportedOperationException}
 * if {@link #getSingleValue(Class)} is called.
 * 
 * @param <T>
 *            the value type
 */
public abstract class SingleValueResolver<T> implements ValueResolver<T> {

    /**
     * {@inheritDoc}
     */
    @Override
    public abstract T getSingleValue(Class<?> componentClass);

    /**
     * Will throw an {@link UnsupportedOperationException}.
     */
    @Override
    public Collection<T> getValues(final Class<?> componentClass) {
        throw new UnsupportedOperationException();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final boolean useSingleValues() {
        return true;
    }

}
